package org.cuatrovientos.erp.model;

import javax.validation.constraints.Size;

import org.hibernate.validator.constraints.Email;

/**
 * Da class for the user
 * @author Enrico Baroni
 *
 */
public class User {
	
	private int id;
	
	@Size(min=2,max=30,message="{user.login.error}")
	private String login;
	
	@Size(min=2,max=100,message="{user.password.error}")
	private String password;
	
	@Size(min=2,max=100,message="{user.name.error}")
	private String name;
	
	@Email(message="{user.email.error}") 
	@Size(max=100, message="{user.emailmax.error}")
	private String email;
	
	private int idrole;
	
	public User () {
		
	}

	
	/**
	 * @param id
	 * @param login
	 * @param password
	 * @param name
	 * @param email
	 * @param idrole
	 */
	public User(int id, String login, String password,
			String name, String email, int idrole) {
		this.id = id;
		this.login = login;
		this.password = password;
		this.name = name;
		this.email = email;
		this.idrole = idrole;
	}

	/**
	 * @return the id
	 */
	public int getId() {
		return id;
	}


	/**
	 * @param id the id to set
	 */
	public void setId(int id) {
		this.id = id;
	}


	/**
	 * @return the login
	 */
	public String getLogin() {
		return login;
	}


	/**
	 * @param login the login to set
	 */
	public void setLogin(String login) {
		this.login = login;
	}


	/**
	 * @return the password
	 */
	public String getPassword() {
		return password;
	}


	/**
	 * @param password the password to set
	 */
	public void setPassword(String password) {
		this.password = password;
	}


	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}


	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}


	/**
	 * @return the email
	 */
	public String getEmail() {
		return email;
	}


	/**
	 * @param email the email to set
	 */
	public void setEmail(String email) {
		this.email = email;
	}


	/**
	 * @return the idrole
	 */
	public int getIdrole() {
		return idrole;
	}


	/**
	 * @param idrole the idrole to set
	 */
	public void setIdrole(int idrole) {
		this.idrole = idrole;
	}


	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return "User [id=" + id + ", login=" + login
				+ ", password=" + password + ", name=" + name
				+ ", email=" + email + ", idrole=" + idrole + "]";
	}
}
